Public Class Login
    Inherits ObjectBase

    Private mlUID As Long
    Private mlDatabaseID As Long
    Private mlDatabaseRevID As Long
    Private msLogin As String
    Private msDesc As String
    Private mbUseIntegratedSecurity As Boolean

    Public Sub New()
        MyBase.New()
    End Sub

    Public Sub New(ByVal lID As Long)
        MyBase.New(lID)
    End Sub

#Region "properties"
    Public Property UID() As Long
        Get
            Return mlUID
        End Get
        Set(ByVal value As Long)
            mlUID = value
        End Set
    End Property

    Public Property DatabaseID() As Long
        Get
            Return mlDatabaseID
        End Get
        Set(ByVal value As Long)
            mlDatabaseID = value
        End Set
    End Property

    Public Property DatabaseRevID() As Long
        Get
            Return mlDatabaseRevID
        End Get
        Set(ByVal value As Long)
            mlDatabaseRevID = value
        End Set
    End Property

    Public Property Login() As String
        Get
            Return msLogin
        End Get
        Set(ByVal value As String)
            msLogin = value
        End Set
    End Property

    Public Property Desc() As String
        Get
            Return msDesc
        End Get
        Set(ByVal value As String)
            msDesc = value
        End Set
    End Property

    Public Property UseIntegratedSecurity() As Boolean
        Get
            Return mbUseIntegratedSecurity
        End Get
        Set(ByVal value As Boolean)
            mbUseIntegratedSecurity = value
        End Set
    End Property

    Public Sub Rev()
        Dim oObject As New DBLogin

        mlRevID = mlRevID + 1

        Me.CreateDate = Now
        oObject.Add(Me)

        mbObjectExists = True
    End Sub
#End Region

#Region "database"
    Public Sub Load()
        Dim oObject As New DBLogin

        oObject.Load(Me)
    End Sub

    Public Sub Save(Optional ByVal bForceAdd As Boolean = False)
        Dim oObject As New DBLogin

        If bForceAdd = False AndAlso mbObjectExists = True Then
            oObject.Update(Me)
        Else
            Me.CreateDate = Now
            oObject.Add(Me)
            mbObjectExists = True
        End If
    End Sub

    Public Sub Delete()
        Dim oObject As New DBLogin

        oObject.Delete(Me)
        mbObjectExists = False
    End Sub
#End Region
End Class
